#ifndef SHAPE_HPP
#define SHAPE_HPP

#include "../math/color_operator.hpp"
#include "../math/ray.hpp"

/**
 * \brief Hit record data structure
 */
struct HitRecord {
  f32 t;
  vec3f normal;
  vec3f color;

  HitRecord() : t( FLT_MAX ), normal( 0, 0, 1 ), color( 0 ) {}

  inline bool operator>( const HitRecord &o ) { return this->t > o.t; }

  inline bool operator<( const HitRecord &o ) { return this->t < o.t; }
};

/**
 * \brief shape class
 */
class Shape {
public:
  virtual bool hit( const Ray &r, f32 tmin, f32 tmax, f32 time,
                    HitRecord &record ) = 0;
  virtual bool shadowHit( const Ray &r, f32 tmin, f32 tmax, f32 time ) = 0;
};

#define SHAPE_HIT_SIGNITURE                                     \
public:                                                         \
  virtual bool hit( const Ray &r, f32 tmin, f32 tmax, f32 time, \
                    HitRecord &record ) override;               \
  virtual bool shadowHit( const Ray &r, f32 tmin, f32 tmax, f32 time ) override;

#endif